﻿package  com.devilcat.ws{
	import com.devilcat.ws.Basicws;
	import com.worlize.websocket.*;
	import com.devilcat.dt.Gamedt;
	
	public class PVPPlayerSwitchws extends Basicws{
		var mInfor:String;
		var mUid:int;
		public function PVPPlayerSwitchws(_uid:int,_infor:String) {
			super("iw-protocol");
			mInfor=_infor;
			mUid=_uid;
			// constructor code
		}
		public function getLead(){
			var pack:Object = new Object();
			pack.uid=mUid;
			pack.action="loadplayerinfor";
			pack.playerinfor=mInfor;
			var myJson:String = JSONString(pack);
			websocket.sendUTF(myJson);
			
		}
		override function handleWebSocketOpen(event:WebSocketEvent):void
		{
		}
		override function handleWebSocketMessage(event:WebSocketEvent):void
		{
			if (event.message.type === WebSocketMessage.TYPE_UTF8)
			{	
				var getdata:Object = JSONObject(event.message.utf8Data)
				Gamedt.BattleUI.PVPAutoSwitchEnd(getdata);
			}
		}

	}
	
}
